package com.small.commom;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

import com.small.AppMsgActivity;
import com.small.SysSettingActivity;
import com.small.act.FavDiscountActivity;
import com.small.act.FavShopActivity;
import com.small.act.LoginActivity;
import com.small.act.UserInfoActivity;

public class Thinksns {
	private static Thinksns thinksns;
	 
	private static Context context; 

	public synchronized static Thinksns getInstance(Context ctx) {
		if (thinksns == null) {
			context = ctx;
			thinksns = new Thinksns(); 
		}
		return thinksns;
	} 

	public void saveUserInfo(String strName,String strPass , boolean isAutoLogin) {
		SharedPreferences sp = context.getSharedPreferences(Common.Userbase_Info,	0);
		Editor spEd = sp.edit();
		spEd.putBoolean(Common.Userbase_isAutoLogin, isAutoLogin);
		spEd.putString(Common.Userbase_UserName,strName );
		spEd.putString(Common.Userbase_Pass, strPass);
		spEd.commit(); 
	} 

	/**
	 * 登录界面
	 * 
	 * @param  
	 * @param  
	 * @param  
	 *             
	 */
//	public void goToLogin() {
//		Intent i = new Intent(context, LoginActivity.class);
////		Bundle bundle = new Bundle();
////		bundle.putString("uid", uid);
////		bundle.putString("uName", uName);
//		// bundle.putSerializable(UserInfoActivity.userInfo, item);
////		i.putExtras(bundle);
//		context.startActivity(i);
//	} 

	/**
	 * 登录  
	 */
	public void goToLogin() { 
		Intent iLogin = new Intent(context, LoginActivity.class); 
		context.startActivity(iLogin);
	} 
	/**
	 * 个人信息        
	 */
	public void goToUserDetail() { 
		Intent idetail=new Intent(context, UserInfoActivity.class); 
		context.startActivity(idetail);
	} 
	/**
	 * 关注商家      
	 */
	public void goToMyFavShop() { 
		Intent iLook=new Intent(context, FavShopActivity.class); 
		context.startActivity(iLook);
	} 
	/**
	 * 我的收藏      
	 */
	public void goToMyFav() { 
		Intent iMyFav=new Intent(context, FavDiscountActivity.class); 
		context.startActivity(iMyFav);
	} 
	/**
	 * 系统消息      
	 */
	public void goToAppMsg() { 
		Intent iSysMsg=new Intent(context, AppMsgActivity.class); 
		context.startActivity(iSysMsg);
	}
	/**
	 * 系统消息      
	 */
	public void goToSysSetting() { 
		Intent iSysSetting=new Intent(context, SysSettingActivity.class); 
		context.startActivity(iSysSetting);
	} 
	
}